package com.zzzyh.forumsystemclient.dao;

import com.zzzyh.forumsystemclient.model.Article;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ArticleMapper {

    List<Article> list(@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    Integer total();

    List<Article> getCarousels();

    List<Article> getRecommends();

    Article getByArticleId(Long articleId);

    List<Article> getAllArticles();

    List<Article> getArticlesByCategoryId(Integer id);

    List<Article> getArticlesByTagId(@Param("tagId") Integer tagId,@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    Integer totalByTagId(Integer tagId);

    Integer totalByCategoryId(Integer categoryId);

    List<Article> getArticlesByCategoryIdByPage(@Param("categoryId") Integer categoryId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    List<Article> getArticlesByUserId(@Param("userId") Integer userId , @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    Integer totalByUserId(Integer userId);

    List<Article> getMyLike(@Param("offset")Integer offset, @Param("pageSize") Integer pageSize, @Param("userId")Integer userId);

    Integer getMyLikeTotal(Integer id);

    void like(@Param("articleId") Long articleId,@Param("userId") Integer userId);

    int isLike(@Param("articleId") Long articleId,@Param("userId") Integer userId);

    void unlike(@Param("articleId") Long articleId,@Param("userId") Integer userId);

    Integer getArticleLikeTotal(Long articleId);

    void add(Article article);

    List<Article> getArticlesByKeyword(@Param("keyword")String keyword,@Param("offset") Integer offset,
                                       @Param("pageSize") Integer pageSize);

    Integer totalByKeyword(String keyword);

    List<Article> getArticlesByTitle(@Param("title")String title,
                                     @Param("userId")Integer userId,
                                     @Param("offset")Integer offset,
                                     @Param("pageSize")Integer pageSize);

    Integer totalByTitle(@Param("title")String title,
                         @Param("userId")Integer userId);

    void addArticleQuantity(Long articleId);

    List<Article> listTop();

    List<Article> getArticlesTopByTagId(Integer tagId);

    List<Article> getArticlesTopByCategoryId(Integer categoryId);

    void update(Article article);

    void delete(Long articleId);
}